<%--
  Created by IntelliJ IDEA.
  User: ICONIC
  Date: 2021/3/24
  Time: 17:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>头部导航</title>
</head>
<body>
<ul class="layui-nav layui-layout-right">
    <!-- 如果未登录 -->
    <c:if test="${empty sessionScope.user and empty sessionScope.admin}">
        <li class="layui-nav-item">
            <a href="tologin">你好，请登录</a>
        </li>
    </c:if>

    <!-- 如果用户已登录 -->
    <c:if test="${not empty sessionScope.user}">
        <li class="layui-nav-item">
            <!-- 用户头像 -->
            <a href="javascript:;">
                <c:if test="${sessionScope.uimg_path==null||sessionScope.uimg_path==''}">
                    <img src="${pageContext.request.contextPath}/static/images/default_head.jpg"
                         class="layui-nav-img"
                    >
                    ${sessionScope.user.uname}
                </c:if>
                <c:if test="${sessionScope.uimg_path!=null&&sessionScope.uimg_path!=''}">
                    <img src="${uimg_path}" class="layui-nav-img"
                    >
                    ${sessionScope.user.uname}
                </c:if>
            </a>
            <dl class="layui-nav-child">
                <dd><a href="getUserInfo?uid=${user.uid}">修改信息</a></dd>
                <dd><a href="toUserSafe?uid=${user.uid}">安全设置</a></dd>
                <dd><a href="gotologinone">切换账号</a></dd>
                <dd><a href="checkMyOrder?obid=${user.uid}">我的订单</a></dd>
                <dd><a href="gotogoodsadd">发布商品</a></dd>
                <dd><a href="showMyGoods?uid=${user.uid}">我的发布</a></dd>
                <dd><a href="gotochongzhi?uid=${user.uid}">充值</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item"><a href="tologout">退出登录</a></li>
    </c:if>

    <%--    如果管理员已登录--%>
    <c:if test="${not empty sessionScope.admin}">
        <li class="layui-nav-item">
<%--            <p>你好，${admin.aname}管理员</p>--%>
    <a href="javascript:;">
        <c:if test="${empty sessionScope.admin.aheadsrc}">
            <img src="${pageContext.request.contextPath}/static/images/default_head.jpg"
                 class="layui-nav-img"
                <%--                         style="width: 50px; height: 50px;margin-left: 15px;"--%>
            >
            管理员${sessionScope.admin.aname}
        </c:if>
        <c:if test="${not empty sessionScope.admin.aheadsrc}">
            <img src="${admin.aheadsrc}" class="layui-nav-img"
                <%--                         style="width: 50px; height: 50px;margin-left: 15px;"--%>
            >
            管理员${sessionScope.admin.aname}
        </c:if>
    </a>
            <dl class="layui-nav-child">
                <dd><a href="${pageContext.request.contextPath}/readAdminInfo">
                    <i class="layui-icon">&#xe68e;</i>&nbsp;我的信息</a>
                </dd>
                <dd><a href="${pageContext.request.contextPath}/toAdminPasswordPage">
                    <i class="layui-icon">&#xe683;</i>&nbsp;安全设置</a>
                </dd>
                <dd><a href="gotoAdminConsole">
                    <i class="layui-icon">&#xe665;</i>&nbsp;进入后台</a>
                </dd>
                <dd><a href="${pageContext.request.contextPath}/adminLoginOut">
                    <i class="layui-icon">&#xe682;</i>&nbsp;退出登录</a>
                </dd>
            </dl>

        </li>
    </c:if>
</ul>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;
    });
</script>
</body>
</html>
